﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using 纸片人.Shaders;

namespace 纸片人.win2dEffectControl.DataClass
{
    public abstract class PixelShaderEffectData : EffectOneSourceData
    {
        /// <summary>
        /// 这个一定要设置
        /// </summary>
        public abstract ShaderType shaderShaderPath { get; }

        protected byte[] shaderCodeBytes;
        public PixelShaderEffectData()
        {
            LoadShaderCode();
        }

        /// <summary>
        /// 加载shader资源
        /// </summary>

        protected async void LoadShaderCode()
        {
            if (shaderCodeBytes == null)
            {
                if (shaderShaderPath == ShaderType.None)
                {
                    return;
                }
                shaderCodeBytes = await shaderShaderPath.LoadAsync();
            }
        }
    }
}
